// userprog.h
#ifdef USER_PROGRAM
// project 2
#include "synch.h"

#define MAX_KERNEL_LOCK 2500
#define MAX_KERNEL_CV 2500
#define MAX_BUF 256
#define MAX_PROCESS_NUM 5
#define MAX_THREAD_NUM 100
// page num for each thread 
#define THREAD_PAGE_NUM 8 
#define MAX_VADDR_PAGES 1000

// table for lock
extern Table lockTable;
// table for condition 
extern Table conditionTable;
// table for vaddr
//extern Table vaddrTable;
// table for paddr
extern Table paddrTable;

// lock for lock
extern Lock *lockForLock;

// lock for condition 
extern Lock *lockForCondition;

// threadSum
extern int threadSum;
extern int processId;
extern Lock *lockForThread;

struct ProcessTable {
  AddrSpace * space;
  int pageTable[MAX_THREAD_NUM][2];
  int totalThreadNum;
  int activeThreadNum;
} ;

extern ProcessTable processTable[MAX_PROCESS_NUM]; 

// kernel Lock
struct KernelLock {
  Lock * lock;
  AddrSpace * addrSpace;
  bool isToDelete;
  int userSum;
};
extern KernelLock kernelLock[MAX_KERNEL_LOCK];

// kernel Condition
struct KernelCV {
  Condition * condition;
  AddrSpace * addrSpace;
  bool isToDelete;
  int userSum;
};
extern KernelCV kernelCV[MAX_KERNEL_CV];

// lockForPageTable
//extern Lock *lockForPageTable;

// processTable ? how bigger is it? [][] ? 
// extern Table processTable;
#endif
